package com.bwie.groupon.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bwie.common.utils.PageUtils;
import com.bwie.common.utils.Query;

import com.bwie.groupon.dao.GrouponDescDao;
import com.bwie.groupon.entity.GrouponDescEntity;
import com.bwie.groupon.service.GrouponDescService;


@Service("grouponDescService")
public class GrouponDescServiceImpl extends ServiceImpl<GrouponDescDao, GrouponDescEntity> implements GrouponDescService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<GrouponDescEntity> page = this.page(
                new Query<GrouponDescEntity>().getPage(params),
                new QueryWrapper<GrouponDescEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public GrouponDescEntity selectByUserId(Integer userId) {
         return baseMapper.selectByUserId(userId);
    }



    @Override
    public GrouponDescEntity getuserId(Integer userId) {
        QueryWrapper<GrouponDescEntity> eq = new QueryWrapper<GrouponDescEntity>().eq("user_id", userId);
        GrouponDescEntity grouponDescEntity = baseMapper.selectOne(eq);
        return grouponDescEntity;
    }

}